﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using Manager.App_Code.IDAL;
using Manager.App_Code.DAL;

namespace Manager.FormMain
{
    public partial class Frm_BarButton_SoDangKyKhachLe : DevExpress.XtraEditors.XtraForm
    {
        public Frm_BarButton_SoDangKyKhachLe()
        {
            InitializeComponent();
        }

        private void Frm_BarButton_SoDangKyKhachLe_Load(object sender, EventArgs e)
        {
            IPhieuDangKy iphieudk = new PhieuDangKyDAL();

            gridControl1.DataSource = iphieudk.GetListPhieuDK();

            int index = gridView1.FocusedRowHandle;

            IChiTietPhieuDangKy ichitetphieu = new ChiTietPhieuDangKyDAL();

            if (index >= 0)
            {
                gridControl2.DataSource = ichitetphieu.GetAllPhieuDKByMaPhieu(long.Parse(gridView1.GetRowCellValue(index, MaPhieu).ToString()));
            }
        }

        private void gridControl1_Click(object sender, EventArgs e)
        {
            int index = gridView1.FocusedRowHandle;

            IChiTietPhieuDangKy ichitetphieu = new ChiTietPhieuDangKyDAL();

            if (index >= 0)
                gridControl2.DataSource = ichitetphieu.GetAllPhieuDKByMaPhieu(long.Parse(gridView1.GetRowCellValue(index, MaPhieu).ToString()));

        }
    }
}